/**
 * 分类模型
 * 对应数据库中的categories表
 */
const { DataTypes } = require('sequelize');
const sequelize = require('../config/database');

const Category = sequelize.define('categories', {
  id: {
    type: DataTypes.INTEGER,
    primaryKey: true,
    autoIncrement: true,
    comment: '分类ID'
  },
  name: {
    type: DataTypes.STRING(50),
    allowNull: false,
    comment: '分类名称'
  },
  icon: {
    type: DataTypes.STRING(50),
    allowNull: true,
    comment: '图标'
  },
  bg_class: {
    type: DataTypes.STRING(50),
    allowNull: true,
    comment: '背景类'
  },
  create_time: {
    type: DataTypes.DATE,
    allowNull: false,
    defaultValue: DataTypes.NOW,
    comment: '创建时间'
  }
}, {
  // 模型选项
  tableName: 'categories',
  timestamps: false // 不使用createdAt和updatedAt字段
});

module.exports = Category;